using System.Collections.Generic;
using RollManager.Library.Utils;

namespace RollManager.Library
{
    partial class Database
    {
        public static Action AddAction( string actionName, int devLevelId, Permission permission )
        {
            return runMapper<Action>( "AddAction", actionName, devLevelId, Common.UserId, (int) permission )[ 0 ];
        }

        public static void CopyAction( int actionId, string name, int devLevelId )
        {
            runQuery( "CopyAction", actionId, name, devLevelId, Common.UserId );
        }

        public static void DeleteAction( int id )
        {
            runQuery( "DeleteAction", id );
        }

        public static Action GetAction( int id )
        {
            return runMapper<Action>( "GetAction", id )[ 0 ];
        }

        public static List<Action> GetActions( int devlevelId )
        {
            return runMapper<Action>( "GetActions", devlevelId, Common.UserId );
        }

        public static void SaveAction( Action action )
        {
            runQuery( "SaveAction", action.Id, action.Name, action.OwnerId, action.PermissionId );
        }
    }
}
